<!-- News.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>新闻中心</title>
		<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
		<link rel="stylesheet" type="text/css" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<style>
			.aui-bar-nav .aui-bar-btn-item.aui-active {
				background-color: #ffffff;
				color: #36353a;
			}
		</style>
	</head>
	<body>
		<div class="base_style_color " id='BarAppearance' style="height: 22px;width: 100%"></div>
		<div class="aui-bar aui-bar-nav base_style_color" style="top: 22px">
			<a class="base_left_item" href="#" onclick="backIndex()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<div class="aui-title">
				<div class="aui-bar aui-bar-btn ">
					<a id="items0" class="aui-items aui-bar-btn-item aui-active" href="#" onclick="item2Click(0)"> 认证动态 </a>
					<a id="items1" class="aui-items aui-bar-btn-item" href="#" onclick="item2Click(1)"> 认证体系 </a>
				</div>
				<!-- 新闻中心 -->
			</div>
		</div>
	</body>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript">
		var type = 1;
		apiready = function() {
			
			setupNotifi();
			api.addEventListener({
				name : 'jumpToNews'
			}, function(ret, err) {
				if (ret) {
					var type1 = ret.value.type;
					if (type1 == 3) {//认证体系
						type = 2;
						item2Click(1);
					} else {//认证新闻
						type = 1;
						item2Click(0);
					}
				}
			});
			//发送滚动到顶部通知
			$('#BarAppearance').click(function() {
				api.sendEvent({
					name : 'scrollTopnNews',
				});
			});
		}
		function setupNotifi() {
			api.addEventListener({
				name : 'showManagementFrameNotifi'
			}, function(ret, err) {
			SendBehaviorTrajectoriesNotifi1(0, '岗位新闻', '150',api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname,  document.title);
				showNewsFrame();
			});
			api.addEventListener({
				name : 'hideManagementFrameNotifi'
			}, function(ret, err) {
			SendBehaviorTrajectoriesNotifi1(1, '岗位新闻', '150',api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname,  document.title);
				hideNewsFrame();
			});
		}

		function showNewsFrame() {
			var y = $('.aui-bar').height() + 22;
			var h = api.winHeight - y - 52;
			api.openFrame({
				name : 'News_frame',
				url : 'News_frame.html',
				rect : {
					x : 0,
					y : y,
					w : 'auto',
					h : h
				},
				pageParam : {
					type : type,
					sourceurl : window.location.pathname,
						sourcetitle : document.title
					
				},
			});
			api.setFrameAttr({
				name : 'News_frame',
				hidden : false
			});
		}

		function hideNewsFrame() {
			api.setFrameAttr({
				name : 'News_frame',
				hidden : true
			});
		}

		function item2Click(itemIndex) {
			if (!$('#items' + itemIndex).hasClass('aui-active')) {
				$('.aui-items').removeClass('aui-active');
				$('#items' + itemIndex).addClass('aui-active');
				// setupGroupIndex(itemIndex);
				//切换导航栏
				switch (itemIndex) {
					case 0:
						openframe(1);
						break;
					case 1:
						openframe(2);
						break;
					default:
						break;
				}
			}
		}

		function openframe(index) {
			var y = $('.aui-bar').height() + 22;
			var h = api.winHeight - y - 52;
			api.openFrame({
				name : 'News_frame',
				url : 'News_frame.html',
				rect : {
					x : 0,
					y : y,
					w : 'auto',
					h : h
				},
				pageParam : {
					type : index,
					sourceurl : window.location.pathname,
						sourcetitle : document.title
				},
				reload : true
			});
		}
	</script>
</html>